package py.una.pol.raphapy.autoventas.view.core;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public abstract class Mensajes {
	
	public static String ERROR = "E";
	public static String WARNING = "W";
	public static String INFO = "I";
	public static String FATAL = "F";
	
    public static void MostrarMensaje(String msg, String tipo) {
        FacesMessage fm = null;
        if ("E".equals(tipo))
            fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, null);
        else if ("W".equals(tipo))
            fm = new FacesMessage(FacesMessage.SEVERITY_WARN, msg, null);
        else if ("I".equals(tipo))
            fm = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, null);
        else if ("F".equals(tipo))
            fm = new FacesMessage(FacesMessage.SEVERITY_FATAL, msg, null);

        FacesContext.getCurrentInstance().addMessage(null, fm);
    }
}